//
//  RecommendCollectionViewCell.m
//  MeterMart
//
//  Created by ENERGY on 2018/11/2.
//  Copyright © 2018年 ENERGY. All rights reserved.
//

#import "RecommendCollectionViewCell.h"

@interface RecommendCollectionViewCell ()
@property (nonatomic, strong)UILabel * titleLab;
@end

@implementation RecommendCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.contentView.backgroundColor = [UIColor whiteColor];
        __weak typeof (self)weakSelf = self;
        [self.contentView addSubview:self.titleLab];
        [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(weakSelf.mas_left);
            make.right.equalTo(weakSelf.mas_right);
            make.top.equalTo(weakSelf.mas_top).mas_offset(9/WIDTH_6_SCALE);
            make.centerY.equalTo(weakSelf.mas_centerY);
        }];
    }return self;
}
- (UILabel *)titleLab{
    if (!_titleLab) {
        _titleLab = [[UILabel alloc] init];
        _titleLab.font = DEF_FontSize_10;
        _titleLab.textColor = [UIColor blackColor];
        _titleLab.textAlignment = NSTextAlignmentCenter;
        _titleLab.text = @"--";
        _titleLab.layer.borderColor = getColor(@"e3e3e3").CGColor;
        _titleLab.layer.borderWidth = 1;
        _titleLab.layer.cornerRadius = 10;
        _titleLab.layer.masksToBounds = YES;
    }return _titleLab;
}

- (void)setModel:(NSDictionary *)model{
    _model = model;
    self.titleLab.text = model[@"search"];
    if ([model[@"ifSelect"] isEqualToString:@"1"]) {
        self.titleLab.backgroundColor = getColor(@"221815");
        self.titleLab.textColor = [UIColor whiteColor];
    }else{
        self.titleLab.backgroundColor = [UIColor whiteColor];
        self.titleLab.textColor = [UIColor blackColor];
    }
}
@end
